package org.aeon.client.handler.Inbound;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.aeon.client.context.GlobalContext;
import org.aeon.message.response.RequestLoginResponseMessage;

/**
 * @author: MissingAeon
 * @date: 2024/1/27 15:45
 * @description:
 */
@Slf4j
@ChannelHandler.Sharable
public class RequestLoginResponseHandler extends SimpleChannelInboundHandler<RequestLoginResponseMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, RequestLoginResponseMessage msg) throws Exception {
        final GlobalContext context = GlobalContext.getContext();
        context.setToken(null);
        context.getIsLogin().set(false);
        // context.set("UnprocessedMessages", msg.getData());
        log.debug("登陆过期");
    }
}
